Dashboarding for Leaders and Managing Data in Shiny

R Gov Conference

DD October 2024

Welcome to the Workshop!

Instructor

MAJ Maxine Drake

 

Assistant

LTC Dusty Turner

Workshop Goals

By the end of this workshop, participants will leave with:

  1. Functional Shiny application templates.
  2. An understanding of
    • Shiny reactivity
    • Functions & Modules in Shiny
    • Dashboard design principles
    • Multi-tiered architectures
    • CRUD apps in R and Shiny
  3. A network of peers for collaboration.
  4. Enhanced skills in R and Shiny.

To Get the Most Out of This Workshop

  1. Latest version of R (Version 4.3.1)

  2. Latest version of RStudio (Version 2023.09.0+463)

  3. Git experience

  4. Basic R Shiny knowledge

  5. Knowledge of your organization’s needs

Workshop Agenda Overview

  • 8:00 AM - 9:00 AM: Welcome, Introductions & Setup
  • 9:10 AM - 10:00 AM: Block 1 - Shiny Reactivity
  • 10:10 AM - 11:00 AM: Block 2 - Functions & Modules in Shiny
  • 11:10 AM - 12:00 PM: Block 3 - Dashboard Design Principles
  • 12:00 PM - 1:00 PM: Lunch
  • 1:00 PM - 1:50 PM: Block 4 - Calendar Module
  • 2:00 PM - 2:50 PM: Block 5 - CRUD apps in R and Shiny
  • 3:00 PM - 3:50 PM: Block 6 - Advanced Techniques & Final Q&A
  • 4:00 PM - 5:00 PM: Hands-on Exercises & Project Work

Maxine Drake: Instructor Introduction

  • Engineer Officer
    • Platoon Leader: North Carolina (and Afghanistan)
    • Company Commander: Leesville, LA
  • Operations Research Systems Analyst (ORSA)
    • Center for Army Analysis, Fort Belvoir, VA
    • Futures & Concepts Center, Fort Eustis, VA

Maxine Drake: Instructor Introduction

  • Education
    • BS Economics & Russian, United States Military Academy
    • MS Operations Research, George Mason University
  • Personal
    • Married to Nate with 3 kids: Charlotte (9), Tommy (5), and Mikey (3)

Dusty Turner: Assistant Introduction

  • Engineer Officer
    • Platoon Leader: Hawaii (Iraq)
    • Company Commander: White Sands Missile Range, NM (Afghanistan)
  • Assistant Professor / Instructor
    • United States Military Academy, West Point, NY
  • Operations Research Systems Analyst (ORSA)
    • Center for Army Analysis, Fort Belvoir, VA

Dusty Turner: Assistant Introduction

  • Education
    • BS Operations Research, United States Military Academy
    • MS Engineering Management, University of Missouri of Science and Technology
    • MS Integrated Systems Engineering, The Ohio State University
    • Applied Statistics Minor
    • Doctoral Candidate, Baylor University, Statistics (Expected 2025)
  • Personal
    • Married to Jill (2010)
    • Children: Cal (2013) and Reese (2015)

Quick Introductions

Let’s go around the room for quick introductions:

  1. Name
  2. Organization
  3. Current role
  4. Experience level with R and Shiny
  5. What you hope to achieve from this workshop

Welcome, Introductions & Setting Up Your Environment


8:00 AM - 9:00 AM

Shiny Reactivity

Mastering Shiny by Hadley Wickham

Shiny Reactivity

Now, we’ll open R_Workshop/04_tutorial_reactives/app_reactives.R and work from there.

Functions & Modules in Shiny

Mastering Shiny by Hadley Wickham

Functions & Modules in Shiny

Now, we’ll open R_Workshop/05_tutorial_modules/app_modules.R and work from there.

Dashboard Design Principles

Effective dashboard design ensures that the audience can quickly absorb critical information and make informed decisions. Here are the key principles:

1. Understand the Purpose, Audience and Context

2. Simple & Clear Visual Elements

  • Opt for simple and effective visualizations.
  • Too many graphs or charts = cognitive overload.
  • Consider interactivity so the user can explore.

Dashboard Design Principles


3. Prioritization of Information
  • Ensure that decision-making data is accessible at a glance.
  • Use size, position, and color to draw attention to key metrics.


4. Balance Timely Data against Speed of App
  • Minimize data operations within app session
  • Maximize user’s ability to see timely data
  • What does “Timely Data” mean for you projects?

Dashboard Design Principles


5. Consistency
  • Consistent formatting, fonts, and color schemes.
  • Consistent types of charts for similar types of data to foster familiarity.


6. Accessibility
  • Ensure the dashboard is easy to use, even for individuals who may not be highly technical.
  • Use color contrast and design elements that are accessible to all users, including those with visual impairments.
  • Provide tooltips or brief explanations for more complex metrics.

Dashboard Design Principles

Resources

  • “The Visual Display of Quantitative Information” by Edward Tufte A classic, emphasizing clarity, precision, and efficiency in visualizing data.

  • “Storytelling with Data: A Data Visualization Guide for Business Professionals” by Cole Nussbaumer Knaflic
    Practical tips for using data visualization as a communication tool, with a focus on business.

  • “Information Dashboard Design: Displaying Data for At-a-Glance Monitoring” by Stephen Few
    Guidelines for creating clear and actionable dashboards that allow users to quickly grasp insights.

  • 8 Essential Dashboard Design Principles for Effective Data Visualization

Lunch Break

12:00 PM - 1:00 PM

Calendars in Shiny

  • {timevis}: Allows you to build interactive timelines in Shiny or Quarto. It is based on the ‘vis.js’ Timeline JavaScript library.

CRUD Apps in R and Shiny

Start with your logical model

Design CRUD tables

CRUD Apps in R and Shiny

Check out R_workshop > app.R

  • Use {rhandsontable}, {reactable}, or {DT} to display selectable/editable tables
  • Control user submissions through shiny::actionButtons
  • Validate user input using functions, such as shiny::req, shiny::validate, shinyfeedback::feedback, and shiny::showNotification
  • A CRUD app could have the following key steps:
    1. Read in data
    2. Join and transform data into user table(s), using a function
    3. Make your user table to a reactive object, using reactiveValues
    4. Upon user submission, there are two subprocesses:
    • Transform submission back into original raw table structure, using a function, then write to data
    • Update your reactive user table with submission

Advanced Techniques & Final Q&A

Hands-on Exercises & Project Work

Summary & Wrap-Up